<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const Student = {
            num:10,
            set(newNum){
                if(newNum>this.num){
                    this.num = newNum;
                }else{
                    throw new Error("班级人数太少，不开办")
                }
            },
            get(){
                return `在班人数${this.num}`;
            }

        }

        Student.set(35)
        console.log(Student.get());
    </script>
</body>
</html>